//
// Copyright (C) 2004-2006  Autodesk, Inc.
// 
// This library is free software; you can redistribute it and/or
// modify it under the terms of version 2.1 of the GNU Lesser
// General Public License as published by the Free Software Foundation.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

#ifndef FDOWCSXMLLAYER_H
#define FDOWCSXMLLAYER_H

#ifdef _WIN32
#pragma once
#endif // _WIN32

#include "FdoOwsBoundingBoxCollection.h"
#include <OWS/FdoOwsGeographicBoundingBox.h>

class FdoWcsContents;
class FdoWcsCoverageSummaryCollection;

class FdoWcsCoverageSummary : public FdoXmlSaxHandler, public FdoIDisposable
{
    typedef FdoXmlSaxHandler BaseType;

public:
    static FdoWcsCoverageSummary* Create(void);

public:
    FdoString* GetIdentifier() const;
    void SetIdentifier(FdoString* identifier);

    FdoString* GetTitle() const;
    void SetTitle(FdoString* title);

    FdoString* GetAbstract() const;
    void SetAbstract(FdoString* abstract);

    FdoStringCollection* GetKeywordList() const;

	/// The method will only return the WGS84 (or EPSG:4326) bounding box listed in the coverage summary.
    FdoOwsBoundingBoxCollection* GetWGS84BoundingBoxCollection() const;
	/// The method will return all the bounding boxes listed in the coverage summary.
    FdoOwsBoundingBoxCollection* GetBoundingBoxCollection() const;
    FdoStringCollection* GetSupportedCRSNames() const;
    FdoStringCollection* GetSupportedFormatNames() const;
    FdoWcsCoverageSummaryCollection* GetCoverageSummaries() const;

    FdoWcsCoverageSummary* GetParent() const;
    void SetParent(FdoWcsCoverageSummary* cs);

    bool FindCoordinateReferenceSystem (FdoString* coordSystem);

public:
    virtual FdoXmlSaxHandler* XmlStartElement(
        FdoXmlSaxContext* context, 
        FdoString* uri, 
        FdoString* name, 
        FdoString* qname, 
        FdoXmlAttributeCollection* atts
        );
    FdoBoolean XmlEndElement(FdoXmlSaxContext* context, FdoString* uri, FdoString* name, FdoString* qname);

protected:
    FdoWcsCoverageSummary(void);
    virtual ~FdoWcsCoverageSummary(void);
    void Dispose();

private:
    FdoXmlCharDataHandlerP                  mXmlContentHandler;
    FdoStringP                              mIdentifier;
    FdoStringP                              mTitle;
    FdoStringP                              mAbstract;
    FdoStringsP                             mKeywordList;

    FdoOwsBoundingBoxCollectionP            mWGS84BoundingBoxes;
    // The collection will contain all the bounding boxes listed in the summary.
    FdoOwsBoundingBoxCollectionP            mBoundingBoxes;
    FdoStringsP                             mSupportedCRSes;
    FdoStringsP                             mSupportedFormats;

    FdoPtr<FdoWcsCoverageSummaryCollection> mChildCoverageSummaries;
    FdoWcsCoverageSummary*                  mParent;
};

typedef FdoPtr<FdoWcsCoverageSummary> FdoWcsCoverageSummaryP;

#endif // FDOWCSXMLLAYER_H